<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="paging" uri="paging-taglib" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%--
  Created by IntelliJ IDEA.
  User: qiliping
  Date: 16/5/2
  Time: 下午6:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>基金年度结算</title>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            基金管理
            <small>基金列表</small>
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="fa fa-home"></i>
                <a href="${ctx}/main">
                    首页
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="${ctx}/product">
                    基金管理
                </a>
                <i class="fa fa-angle-right"></i>
            </li>
            <li>
                <a href="#">
                    基金年度结算
                </a>
            </li>
        </ul>
        <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>

<div class="main">

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-primary">

                <div class="panel-body">
                    <div class="form-group">
                        <label class="control-label">基金名称：</label>
                        <span>${product.productName}</span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">基金编号：</label>
                        <span>${product.productCode}</span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">基金管理人：</label>
                        <span>${product.fundCompanyName}</span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">基金经理：</label>
                        <span>
                            ${product.fundManagerName}
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">总规模 ：</label>
                        <span>
                        <fmt:formatNumber value="${product.productTotalScale }" type="number" maxFractionDigits="4" minFractionDigits="4"></fmt:formatNumber>万元
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">最低投资金额：</label>
                        <span>
                        <fmt:formatNumber value="${product.minInvsetAmount }" type="number"></fmt:formatNumber>万元
                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label">当前净值：</label>
                        <span>
                            <fmt:formatNumber value="${ProductNewNetValue}" type="number" maxFractionDigits="4" minFractionDigits="4"></fmt:formatNumber>元

                        </span>
                    </div>
                    <div class="form-group">
                        <label class="control-label pull-left">成立时间：</label>
                        <span>
                            <fmt:formatDate value="${product.registerDate}" pattern="yyyy-MM-dd"/>

                        </span>
                    </div>

                    <div class="form-group">
                        <label class="control-label pull-left">状态：</label>
                        <span>
                             <c:choose>
                                 <c:when test="${product.productStatus == 0}">
                                     草稿中
                                 </c:when>
                                 <c:when test="${product.productStatus == 3}">
                                     预约中
                                 </c:when>
                                 <c:when test="${product.productStatus == 4}">
                                     募集中
                                 </c:when>
                                 <c:when test="${product.productStatus == 8}">
                                     运行中
                                 </c:when>
                                 <c:when test="${product.productStatus == 9}">
                                     已结束
                                 </c:when>
                             </c:choose>

                        </span>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <form:form method="post" class="form-horizontal">


                <c:choose>
                    <c:when test="${result==1}">
                    <div class="form-group">
                        <div class="col-md-9 col-md-offset-3">
                            <span class="field-validation-error">${msg}</span>
                        </div>
                    </div>
                    </c:when>
                    <c:otherwise>
                        <div class="form-group">
                            <label class="control-label col-md-3">基金净值：</label>
                            <div class="col-md-3">
                                <div class="input-group">
                                    <select name="netvalue">
                                        <c:forEach var="item" items="${netvalueList}">
                                            <option value="${item.netvalue}"><fmt:formatDate value="${item.calculateTime}" pattern="yyyy-MM-dd"></fmt:formatDate>  <fmt:formatNumber value="${item.netvalue}" pattern="0.0000"></fmt:formatNumber>元</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-9 col-md-offset-3">
                                <button type="submit" class="btn blue">确认结算</button>
                                <span class="field-validation-error">${error}</span>
                            </div>
                        </div>
                    </c:otherwise>
                </c:choose>

            </form:form>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">
            <table class="table table-striped table-hover zqy-table">
                <thead>
                <tr>

                    <th>投资人姓名</th>
                    <th>投资人手机号</th>
                    <th>购买产品</th>
                    <th>购买金额</th>
                    <th>购买时间</th>
                    <th>理财顾问</th>
                    <th>状态</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="item" items="${investList}">
                    <tr>
                        <td>${item.userName}</td>
                        <td>${item.userPhone}</td>
                        <td>${item.productName}</td>
                        <td>
                            <c:choose>
                                <c:when test="${item.investmentStatus==0}">
                                    ${item.orderAmount}万元
                                </c:when>
                                <c:otherwise>
                                    ${item.investmentAmount}万元
                                </c:otherwise>
                            </c:choose>

                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${item.investmentStatus==0}">
                                    <fmt:formatDate value="${item.orderTime}" pattern="yyyy-MM-dd HH:mm"/>
                                </c:when>
                                <c:otherwise>
                                    <fmt:formatDate value="${item.investmentTime}" pattern="yyyy-MM-dd HH:mm"/>
                                </c:otherwise>
                            </c:choose>

                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${item.salemanId!=0}">
                                    ${item.salemanName}
                                </c:when>
                                <c:otherwise>
                                   未分配理财顾问
                                </c:otherwise>
                            </c:choose>

                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${item.investmentStatus == 0}">
                                    <c:choose>
                                        <c:when test="${item.orderStatus==0}">
                                            未支付&nbsp;&nbsp;&nbsp;
                                        </c:when>
                                        <c:when test="${item.orderStatus==1}">
                                            等待买入&nbsp;&nbsp;&nbsp;&nbsp;
                                        </c:when>
                                    </c:choose>
                                </c:when>

                                <c:otherwise>
                                    <c:choose>
                                        <c:when test="${item.investmentStatus == 1}">
                                            运行中
                                        </c:when>
                                        <c:when test="${item.investmentStatus == 3}">
                                            赎回中
                                        </c:when>
                                        <c:when test="${item.investmentStatus == 4}">
                                            已赎回
                                        </c:when>
                                    </c:choose>
                                </c:otherwise>

                            </c:choose>

                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <div class="text-center">
                <ul class="pagination">
                    <paging:paging pageIndex="${pageIndex}" totalPage="${totalPage}" href="${ctx}/product/year_settlement"
                                   htmlTag="li"></paging:paging>

                </ul>
            </div>

        </div>
    </div>

</div>
</body>
</html>
